package com.zcx.qshop.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;

import com.zcx.qshop.R;

/**
 * Created by Administrator on 2015/9/25 0025.
 */
public class LoadYCView extends ImageView {

    private AnimationSet onAnimation;

    public LoadYCView(Context context, AttributeSet attrs) {

        super(context, attrs);

        setBackgroundResource(R.mipmap.load_yc);

        onAnimation = new AnimationSet(true);

        onAnimation.addAnimation(new ScaleAnimation(0.9f, 1.0f, 0.9f, 1.0f, 50, 50));

        onAnimation.addAnimation(new AlphaAnimation(0.5f, 1.0f));

        onAnimation.setDuration(1500);

    }

    public void startNow(){

        setAnimation(onAnimation);

        onAnimation.startNow();

    }

    public void cancel(){

        onAnimation.cancel();

    }

}
